<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $user = M("admin") -> field('username') ->select();
        $name = $user[0]['username'];
        if(!session('user.username') == $name){
            $this -> error("登录超时，请重新登录",U("Login/index"));
        }

        $this -> assign("name",$name);
        $this->display();
    }

    public function welcome(){
    	// echo "<pre>";
    	// print_r($_SERVER);
    	$name = $_SERVER['SERVER_NAME'];
    	$ip = $_SERVER["SERVER_ADDR"];
    	$domain = $_SERVER['HTTP_HOST'];
    	$port = $_SERVER['SERVER_PORT'];
    	$path = $_SERVER['DOCUMENT_ROOT'];
    	$software = PHP_OS;
    	$time = time();
        $info = M('logininfo') -> select();
        $this -> assign('info',$info[0]);
    	$this->assign('name',$name);
    	$this->assign('ip',$ip);
    	$this->assign('domain',$domain);
    	$this->assign('port',$port);
    	$this->assign('path',$path);
    	$this->assign('software',$software);
    	$this->assign('time',$time);
    	$this->display('welcome');
    }

    public function login_out(){
        session(null);
        $this -> success("退出登录",U("Login/index"));
    }
}